﻿/**
 * Created by Administrator on 2018/10/8.
 */
+function ($) {
    var ExtDatePicker = function (f, e) {
        this.$element =  $(f);
        this.options = $.extend({}, ExtDatePicker.DEFAULTS, e);
        this.init()
    };
    ExtDatePicker.DEFAULTS = {
        language: 'zh-CN',
        orientation: "auto",
        autoclose: true,
        format: "yyyy-mm-dd"
    };
    ExtDatePicker.prototype.init = function () {
        var datepicker =  this.$element, options = this.options;
        datepicker.datepicker(options);
    }
    function Plugin(e) {
        Bolt.assert($.fn.datepicker, "依赖组件 iCheck 未引入");
        return this.each(function () {
            var h = $(this);
            var g = h.data("extDatePicker");
            var f = typeof e == "object" && e;
            if (!g) {
                h.data("extDatePicker", (g = new ExtDatePicker(this, f)))
            }
            if (typeof e == "string") {
                g[e]()
            }
        })
    }
    $.fn.extDatePicker = Plugin
    $.fn.extDatePicker.Constructor = ExtDatePicker;

    Bolt.addComponent({
        name: "ExtDatePicker",
        plugin: Plugin,
        runPoint: Bolt.eventType.afterAjaxPageShow,
        expr: "input[data-toggle='date']",
        order: 800
    })
}(jQuery);